/*
	Decoder.h - Library for 

	Created by the LSI Capstone team at UMBC on March 11, 2014


 */


#ifndef Decoder_h
#define Decoder_h

class Decoder {
	public:
		//Decoder(int oPin_CD, int oPin_WR, int oPin_RD, int oPin_FLG1, 
		//	int oPin_FLG2, int oPin_FCLK);
		Decoder();
		unsigned long readCounter();
		unsigned long readCountDEBUG();
		void initializeDecoder();
		void startClock();

		//--------------//--------------//--------------//--------------
		void disableAB();
		void enableAB();
		void setCounter(unsigned long Data);
		unsigned char getFlags();
		unsigned long connectionTest(unsigned long Data);
		unsigned long lrotr(unsigned long Data, unsigned char bits);
		//--------------//--------------//--------------//--------------

	private:
		void writeData(unsigned long Data);
		//unsigned char getFlags();
		unsigned char inp(int Addr);
		void outp(int Addr, unsigned char Data);

		int Addr;
		// Decoder Control Pins on uC
		int oPin_CD;
		int oPin_WR;
		int oPin_RD;
		int oPin_FCLK;
		int oPin_CS;

		int iPin_FLG1;
		int iPin_FLG2;

		// Test
		int countDEBUG;
};

#endif
